The Carbon, Absorption, and Fluorescence Euphotic-resolving (CAFE) net primary production model is an adaptable framework for advancing global ocean productivity assessments by exploiting state-of-the-art satellite ocean color analyses and addressing key physiological and ecological attributes of phytoplankton.
Calculated sum of 2014 to 2023 monthly net primary production (NPP) from VIIRS data.
Community guidance for developing this website was to provide a single productivity product as a Standard product. For this, we initially chose the original Vertically Generalized Production Model (VGPM) (Behrenfeld and Falkowski, 1997a) as the standard algorithm. The VGPM is a “chlorophyll-based” model that estimate net primary production from chlorophyll using a temperature-dependent description of chlorophyll-specific photosynthetic efficiency. For the VGPM, net primary production is a function of chlorophyll, available light, and the photosynthetic efficiency.
Standard products are based on chlorophyll, temperature and PAR data from SeaWiFS, MODIS and VIIRS satellites, along with estimates of euphotic zone depth from a model developed by Morel and Berthon (1989) and based on chlorophyll concentration.
if (!file.exists(vgpm_tif)) {for (yr in yrs){ # yr = 2015# vgpm_yr_tif <- glue("{dir_vgpm}/cafe.v.{yr}.tif") vgpm_yr_tif <-glue("{dir_vgpm}/vgpm.{yr}.tif")if (!file.exists(vgpm_yr_tif)) { tar <-glue("vgpm.v.{yr}.tar") url_tar <-glue("https://orca.science.oregonstate.edu/data/2x4/monthly/vgpm.r2022.v.chl.v.sst/hdf/{tar}") path_tar <-file.path(dir_vgpm, tar)dir_create(dirname(path_tar))if(!file_exists(path_tar))download.file(url_tar, path_tar, method ="curl", extra ="-k -L") dir_untar <-path_ext_remove(path_tar)dir_create(dir_untar)untar(path_tar, exdir = dir_untar)# Get list of compressed files files_gz <-dir_ls(dir_untar, glob ="*.gz") dir_unzip <-path(dir_untar, "unzipped")dir_create(dir_unzip)# Unzip all filesfor (file_gz in files_gz) { # file_gz = files_gz[1] file_hdf <-path(dir_unzip, sub("\\.gz$", "", basename(file_gz)))if (!file.exists(file_hdf))gunzip(file_gz, destname = file_hdf) }# Get list of unzipped HDF files files_hdf <-dir_ls(dir_unzip, glob ="*.hdf") # length(files_hdf) = 12# Function to read VGPM data from HDF file read_vgpm_hdf <-function(file_hdf) { # file_hdf <- files_hdf[7]# First, query the HDF file to see the subdatasets# file_exists(file_hdf) r <-read_stars(file_hdf) |># read all subdatasetsrast()ext(r) <-c(-180, 180, -90, 90) # set extent to globalcrs(r) <-"epsg:4326"NAflag(r) <--9999names(r) <-"npp"# set name for all layerstime(r, tstep ="yearmonths") <-basename(file_hdf) |>str_replace("vgpm.([0-9]+).hdf", "\\1") |>as_date(format ="%Y%j") r }# Initialize a list to store all monthly rasters monthly_rasters <-list()# Read all monthly filesfor (i inseq_along(files_hdf)) {if (verbose)message("Processing file", i, "of", length(files_hdf), ":", files_hdf[i], "\n") r <-read_vgpm_hdf(files_hdf[i])if (!is.null(r)) { monthly_rasters[[i]] <- r } }# Create a SpatRaster collection from all the monthly rasters r_yr <-rast(monthly_rasters) |>mean(na.rm = T)names(r_yr) <-"npp"time(r_yr, tstep ="years") <- yrwriteRaster(r_yr, vgpm_yr_tif, overwrite =TRUE)dir_delete(dir_untar)file_delete(path_tar)message(glue("Created annual for {yr}: {basename(vgpm_yr_tif)}")) } }# aggregate across years ---- r_yrs <-dir_ls(dir_vgpm, glob ="*.tif") |>rast() r_avg <- r_yrs |>mean(na.rm = T) r_sd <- r_yrs |>stdev(na.rm = T) r <-c(r_avg, r_sd) |>setNames(glue("npp_{c('avg','sd')}")) r |>writeRaster(vgpm_tif, overwrite = T)}r <-rast(vgpm_tif, lyrs ="npp_avg")# # rotate(left=F) # -180 to 180 -> 0 to 360# # shift(dx = 0.0001) # problem with -180 extentvgpm_png <-here("figs/ingest_productivity/map_vgpm_avg.png")if (!file.exists(vgpm_png)){ m <-mapView( r, maxpixels =ncell(r), col.regions =cmocean("algae"),layer.name =glue("NPP avg")) |>slot("map") |># addFullscreenControl() |>addControl(tags$div(HTML("units: mg C / m<sup>2</sup> / day")), position ="topright")mapshot2(m, file = vgpm_png)}
Figure 1: Static map (to limit file size) of Standard VGPM from VIIRS satellite, averaged across all months and years 2014 to 2023.